package com.fzj.example.design.iterator;

import java.util.ArrayList;
import java.util.List;

/**
* @Description
* @Author  fanzj
* @Date   2020/5/10 9:38 下午
* @Param
* @Return
* @Exception
*
*/
public class ConcreteAggregate implements Aggregate {

    private List<Object> objectList=new ArrayList<>();

    @Override
    public void add(Object obj) {
        this.objectList.add(obj);
    }

    @Override
    public void remove(Object obj) {
        this.objectList.add(obj);
    }

    @Override
    public Iterator getIterator() {
        return new ConcreteIterator(objectList);
    }
}
